# SINAD inicator SPECs (R909-SINAD inicator) ##Arduino IDE (ESP32-C3 sketch) ## the hardware ESP32-C3 SUPER MINI DEV KIT ├── GPIO1 ← ADC input(audio signal) ├── GPIO2 ← rotary encoder A phase ├── GPIO3 ← rotary encoder B phase ├── GPIO4 ← rotary encoder switch ├── GPIO5 → ├── GPIO6 → 1kHz pulse output ├── GPIO7 → for checking loop timing ├── GPIO8 ↔ I2C SDA(OLED) └── GPIO9 ↔ I2C SCL(OLED) ``` ## the software ### 1. signal generator ``` [DDS signal ] └── GPIO6: 1kHz pulse output(2kHz ON/OFF) ``` ### 2. signal aquision processing ``` [ADC aquision] (200ms cycle) analogRead(GPIO1) → 512 samples @ 10kHz ↓ voltage converted: (ADC-1473)/4096 * 3.3V ↓ [siganl processing] inputBuffer[512] → the original data ↓ applyNotchFilter() → feeding for notch(1kHz, Q=10) ↓ notchBuffer[512] → the filtered signal ↓ [calculation] calculateRMS(inputBuffer) → input value by RMS calculateRMS(notchBuffer) → notched value by RMS ↓ calculateSINAD() → to get SINAD value ``` ### 3. man machine interface ``` [operation] rotary encoder → switching display Mode(6 modes) rotary encoder SW → DDS ON/OFF switch [displaying] OLED SSD1306 (i2c) ├── Mode 0: SINAD display ├── Mode 1: wave display ├── Mode 2: wave display enlarged ├── Mode 3: wave display notched ├── Mode 4: wave display notched, enlarged ├── Mode 5: FFT display ├── Mode 6: FFT display notched ├── Mode 7: parameter monitor └── Mode 8: tuning sampling timing ``` ### 4. controle・managing ``` [main] setup() → initializing ├── assign ports ├── assign interrupt ├── set the DDS ├── set the notch filter └── set the OLED loop() → main(200ms cyccling) ├── sence the switches ├── sence the encoder ├── get ADC・process the signals └── refresh display ``` ## data flow ``` recieved signal → ADC(GPIO1) → conversion → inputBuffer ↓ inputBuffer → filtered → notchBuffer ↓ RMS calculation → SINAD issued → display the test signal (turning on/off by RE-SW pushing) DDS test signal output (GPIO6) → 1kHzパルスpulse ``` test signal (turned on by F-SW1 pushing) issue the inbuffer[] 512 samples on serial port ``` test signal (set precise tuning mode by F-SW2 pushing) get into Mode 8 and inclease or decrease ADC sampling adjustment setting ``` ## the majar parameters - **DDS**: 2kHz refreshing rate ON/OFF - **ADC**: 10kHz sampling、512 smples/cycle - **notch filter**: 1kHz、Q=10 - **display refresh**: 200ms cycle - **ADC offset**: 1473 (about 1.18V) ## testing function↓(turning on with pressing SW1) already calculated 1kHz mode - **testwaveEnabled**: generated inside testing value  512 samples calculated of 1kHz→ start by input Buffer preset